//
//  JW_BrowseViewController.m
//  JWMovie
//
//  Created by Jorn.Wu on 15/7/23.
//  Copyright (c) 2015年 Jorn.Wu. All rights reserved.
//

#import "JW_BrowseViewController.h"
#import "JW_CollectionView.h"

#define JWScreenWidth [UIScreen mainScreen].bounds.size.width
#define JWScreenHeight [UIScreen mainScreen].bounds.size.height

@interface JW_BrowseViewController ()


@end

@implementation JW_BrowseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg_main@2x"]];
    
    [self addCancleBtn];
    [self addCollectionView];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationAction) name:@"NavigationBarHidden" object:nil];
}
- (void)notificationAction{
    BOOL hidden = self.navigationController.navigationBar.isHidden;
    
    [self.navigationController setNavigationBarHidden:!hidden animated:YES];
}

- (void)addCollectionView{
    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
    layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;

    JW_CollectionView *collectionView = [[JW_CollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:layout];
    collectionView.num = self.clickTag;
    collectionView.imageUrlAr = self.imageUrlAr;
    
    [self.view addSubview:collectionView];
    
}

- (void)addCancleBtn{
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonItemStylePlain target:self action:@selector(cancleBtnAction)];
}

- (void)cancleBtnAction{
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
